package com.cskaoyan.bean.order.wxGetOrder;

import com.baomidou.mybatisplus.annotation.TableName;
import com.cskaoyan.bean.domain.Order;
import com.cskaoyan.bean.domain.OrderGoods;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author looper
 * @
 **/
@Data
public class OrderList extends Order{
    BigDecimal actualPrice;
    Short aftersaleStatus;
    Integer id;
    //是否团购
    Boolean isGroupin;
    String orderSn;

    Short orderStatus;
    //订单状态
    String orderStatusText;
    List<OrderGoods> goodsList;
    HandleOption handleOption;

    /**
     * 当对订单状态赋值的时候,调用订单状态描述'的赋值方法,赋值中文
     * @param orderStatus
     */
    public void setOrderStatus(Short orderStatus) {
        this.orderStatus = orderStatus;
        this.setOrderStatusText(orderStatus);
    }

    /**
     * 根据传入的状态数字,赋值对应中文
     * @param orderStatus
     */
    public void setOrderStatusText(Short orderStatus) {

        if (orderStatus!=null){
            if (101==orderStatus){
                this.orderStatusText = "未付款";
            }else if (102==orderStatus){
                this.orderStatusText = "用户取消";
            }else if (103==orderStatus){
                this.orderStatusText = "已取消(系统)";
            }else if (201==orderStatus){
                this.orderStatusText = "已付款";
            }else if (202==orderStatus){
                this.orderStatusText = "申请退款";
            }else if (203==orderStatus){
                this.orderStatusText = "已退款";
            }else if (301==orderStatus){
                this.orderStatusText = "已发货";
            }else if (401==orderStatus){
                this.orderStatusText = "用户收货";
            }else if (402==orderStatus){
                this.orderStatusText = "系统收货";
            }else {
                this.orderStatusText = "奇怪的返回了";
            }
        }
    }

}
